package com.jin.webvideo.entity;

import com.jin.webvideo.base.util.SystemInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
public class ForbidRecord {
    // ip 地址
    public static final String TYPE_INET4ADDRESS = "inet4Address";
    public static final String TYPE_INET6ADDRESS = "inet6Address";
    // 用户
    public static final String TYPE_USER = "user";
    // 封禁所有请求 只有在 type=user时生效
    public static final String FORBID_TYPE_USER_ROLE = "role";
    // 封禁访问路径
    public static final String FORBID_TYPE_PATH = "path";
    //
    public static final long TIME_FOREVER = 157145673600000L;
    public static final String PATH_ALL = "/*";
    // 封禁时间
    private Date startTime;
    // 解封时间
    private Date endTime;
    // 封禁原因
    private String information;
    // 记录类型
    private String type;
    // user 账号， inetAddress IP地址
    private String start;

    private String end;
    // 封禁类型
    private String forbidType;
    //
    private String val;

    public ForbidRecord(long time, String information, String type, String key) {
        long now = SystemInfo.now();
        this.startTime = new Date(now);
        this.endTime = new Date(now + time*1000);
        this.information = information;
        this.type = type;
        this.start = key;
        this.end = key;
    }
}
